#define  _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main()
{
	int n = 0;
	scanf("%d", &n);
	int i = 0;
	int count = 0;
	for (i = 30; i >= 0; i -= 2)
	{
		printf("%d", (n >> i) & 1);
		count++;
		if (count % 8 == 0)
			printf(" ");
	}
	printf("\n");
	count = 0;
	for (i = 31; i >= 0; i -= 2)
	{
		printf("%d", (n >> i) & 1);
		count++;
		if (count % 8 == 0)
			printf(" ");

	}
	printf("\n");
	return 0;
}